//
// Created by void on 24-1-8.
//

#ifndef RECTORHTTPSERVER_CHANNEL_H
#define RECTORHTTPSERVER_CHANNEL_H
#include <stdlib.h>
#include <stdbool.h>


typedef int(*handleFunc)(void* arg);

enum FDEvent {
    TimeOut = 0x01,
    ReadEvent = 0x02,
    WriteEvent = 0x04
};

struct Channel {
    int fd;
    int events;
    handleFunc readCallback;
    handleFunc writeCallback;
    handleFunc destroyCallback;
    void * arg;
};

struct Channel* channelInit(int fd, int events, handleFunc readFunc, handleFunc writeFunc,
        handleFunc destroyFunc, void* arg);

void writeEventEnable(struct Channel* channel, bool flag);
bool isWriteEventEnable(struct Channel* channel);




#endif //RECTORHTTPSERVER_CHANNEL_H
